package com.fifth.emp.controller;

import com.fifth.common.pojo.dto.CommonResult;
import com.fifth.common.pojo.entity.Examine;
import com.fifth.emp.service.IExamineService;
import com.fifth.emp.service.impl.ExamineServiceImpl;
import org.checkerframework.checker.units.qual.A;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.stereotype.Controller;

/**
 * <p>
 * 审查表 前端控制器
 * </p>
 *
 * @author 第五组
 * @since 2022-09-08
 */
@RestController
@RequestMapping("/emp/examine")
public class ExamineController {

    @Autowired
    private IExamineService examineService;


    /**
     * 查询审查记录 分页 范围时间查询
     * @param currentPage
     * @param pageSize
     * @param startTime
     * @param endTime
     * @return
     */
    @PostMapping("/getExamine")
    public CommonResult getExamine(@RequestParam(defaultValue = "1") Integer currentPage, @RequestParam(defaultValue = "5") Integer pageSize, String startTime, String endTime){
        return examineService.getExamine(currentPage,pageSize,startTime,endTime);
    }


    /**
     * 删除审查记录
     * @param id
     * @return
     */
    @PostMapping("deleteExamine/{id}")
    public CommonResult deleteExamine(@PathVariable String id){
        return examineService.deleteExamine(id);
    }

    /** TODD
     * 添加审查
     * @param examine
     * @return
     */
    @PostMapping("insertExamine")
    public CommonResult insertExamine(@RequestBody Examine examine){
        System.out.println("===================="+examine);
        return examineService.insertExamine(examine);
    }

    /**
     * 查询所有店铺及id
     */
    @PostMapping("/selectBusiness")
    public CommonResult selectBusiness(){
        return examineService.selectBusiness();
    }
}
